package com.zdd.ehe.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zdd.ehe.entity.Produce;
import com.zdd.ehe.mapper.ProduceMapper;
import com.zdd.ehe.service.ProduceService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @version 1.0.0
 * @title: ProduceServiceImpl
 * @author: HFLy
 * @description:
 * @date: 6/3/2023 下午3:00
 */
@Service
public class ProduceServiceImpl extends ServiceImpl<ProduceMapper, Produce> implements ProduceService {
    @Resource
    private ProduceMapper produceMapper;
    /**
     * 通过产品类型查找产量和销量
     *
     * @param type
     * @return
     */
    @Override
    public List<Produce> queryProduceAndSaleByType(String type) {
        QueryWrapper<Produce> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("type",type);
        List<Produce> produceList = produceMapper.selectList(queryWrapper);
        return produceList;
    }
}
